#pragma once
#include "Vector4.h"

VAMPIRE_NAMESPACE_BEGIN

class _VampireExport ColorValue : public MemoryAlloc
{
public:
	ColorValue(void) {}

	explicit ColorValue(const D3DXCOLOR& data) { mData = data; }

	ColorValue(Real r, Real g, Real b, Real a);

	ColorValue                  operator + (const ColorValue& rhs) const;
	ColorValue                  operator - (const ColorValue& rhs) const;
	ColorValue                  operator * (const Real& rhs) const;

	_VampireExport friend ColorValue operator * (const Real& lhs, const ColorValue& rhs)
	{
		return ColorValue(rhs.mData * lhs);
	}

	ColorValue                  operator / (const Real& rhs) const;

	ColorValue&                 operator += (const ColorValue& rhs);
	ColorValue&                 operator -= (const ColorValue& rhs);
	ColorValue&                 operator *= (const Real& rhs);
	ColorValue&                 operator /= (const Real& rhs);

	void                        operator = (const ColorValue& rhs);
	void                        operator = (const D3DXCOLOR& rhs);

	bool                        operator == (const ColorValue& rhs) const;
	bool                        operator != (const ColorValue& rhs) const;

	ColorValue                  operator + () const;
	ColorValue                  operator - () const;

	void                        adjustContrast(Real c);

	ColorValue                  getAdjustConstrastColor(Real c) const;

	void                        adjustSaturation(Real s);

	ColorValue                  getAdjustSaturationColor(Real s) const;

	void                        blendWith(const ColorValue& color);

	ColorValue                  getBlendedColor(const ColorValue& color) const;

	void                        negative();

	ColorValue                  getNegative() const;

	ColorValue                  add(const ColorValue& color) const; 

	ColorValue                  subtract(const ColorValue& color) const;

	void                        scale(Real s);

	ColorValue                  getLerpedColor(const ColorValue& color, Real s) const;

	Vector4                     toVector4() const;

	D3DXCOLOR                   mData;

	static const ColorValue     BLACK;
	static const ColorValue     WHITE;
	static const ColorValue     RED;
	static const ColorValue     GREEN;
	static const ColorValue     BLUE;
};

VAMPIRE_NAMESPACE_END
